#!/usr/bin/env python 
#coding=utf-8

import salt.client
client = salt.client.LocalClient()
# print  client.cmd("*","test.ping")


def test_2():

    minion_id="vm-win7-01"
    confPath="C:\\Program Files (x86)\\McpServer\\config.ini"
    _section="Config"

    #minion_id="jxm-pc-windows"
    #confPath="C:\\config.ini"
    #_section="Other"


    #print  client.cmd(minion_id,"test.ping")
    print " 1. get config info"
    ret = client.cmd(minion_id,'mcpServerConfig_module.get_config_info',[confPath,_section])
    print ret
    print " 2. change"
    #ret = client.cmd(minion_id,'file.set_attributes',[confPath,None,None,None,None,False])
    #ret = client.cmd(minion_id,'file.stats',[confPath])
    ret = client.cmd(minion_id,'mcpServerConfig_module.change_config_info',["Model","test 123",confPath,_section])
    print ret

    print " 3.  add "
    ret = client.cmd(minion_id,'mcpServerConfig_module.add_config_info',["mmmm","test 123",confPath,_section])
    print ret

    print  " 4. delete "
    ret = client.cmd(minion_id,'mcpServerConfig_module.del_config_info',["mmmm",confPath,_section])
    print ret

    print " add section"
    ret = client.cmd(minion_id,'mcpServerConfig_module.add_section',["other3",confPath])
    print ret

    print " del section"
    ret = client.cmd(minion_id,'mcpServerConfig_module.del_section',["other2",confPath])
    print ret
def main():
    test_2()

try:
    if __name__ == "__main__":
        main()
except Exception as e:
    print e.message
